package com.socket.socket.demos.socket;

import com.socket.socket.demos.socket.SocketService;
import org.springframework.boot.CommandLineRunner;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
public class SocketHandler implements CommandLineRunner {

    private final SocketService socketService;

    public SocketHandler(SocketService socketService) {
        this.socketService = socketService;
    }

    @Override
    public void run(String... args) throws IOException {
        System.out.println("Starting Socket Server...");
        socketService.startServer();
    }
}
